home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / fido / XPACK275.lha / rexx / Xlist.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-17  |  2KB  |  63 lines

  1. /**/
  2. v='$VER: Xlist Rexx Site Queue Lister  Williamson 55.04'
  3. if ~show("L", "xferq.library") then
  4.   if ~addlib("xferq.library", 0, -30, 0) then do
  5.     say "Couldn't access xferq.library !"
  6.     exit 20
  7.   end
  8. if ~show("L", "rexxdossupport.library") then
  9.   if ~addlib("rexxdossupport.library", 0, -30, 2) then do
  10.     say "Couldn't access rexxdossupport.library !"
  11.     exit 20
  12.   end
  13.  
  14. lf='0a'x
  15. showall=1
  16. if arg()~=0 then do
  17.   parse upper arg site_pattern
  18.   showall=0
  19. end
  20. sitelist=XfqGetSiteList()
  21. call XfqWalkSession(sitelist,sites)
  22. buf=lf||copies(" ",45)||'9B'x||'1mXLIST v'right(v,5)||'9B'x||'0m'||lf
  23. do loop = 1 to sites.numentries
  24.   addrtags.XQ_Mandatory=511;addrtags.XQ_Optional=511
  25.   System=XfqPutAddress(sites.loop,addrtags)
  26.   if ~showall & ~MatchPattern(site_pattern,upper(System),'N') then iterate
  27.   call XfqWalkQueue(sites.loop,stem)
  28.   buf=buf||lf||copies(" ",45)||'9B'x||'1m'||System||'9B'x||'0m'||lf
  29.   do i=1 to stem.numentries
  30.     bits=""
  31.     if stem.i.FLAGS=0 then f='L'
  32.     else do
  33.       bin=bitXOR(d2x(stem.i.FLAGS),'00110000'B);f=""
  34.       do z=7 to 0 by -1
  35.         if bittst(bin,z) then bits=bits||'1'
  36.         else bits=bits||'0'
  37.       end
  38.       if bittst(bin,4) then f=f||'K'
  39.       if bittst(bin,3) then f=f||'A'
  40.       else if bittst(bin,2) then f=f||'I'
  41.       if bittst(bin,1) then f=f||'T'
  42.       else if bittst(bin,0) then f=f||'D'
  43.       else f=f||'L'
  44.   end
  45.   buf=buf||left_justify(stem.i.NAME,44)" "left_justify(stem.i.ASNAME,14)" "right_justify(stem.i.PRI,3)" "f" "bits||lf
  46.   end
  47. end
  48. call XfqDropObject(sitelist)
  49. call XfqClose()
  50.  
  51. call writech(STDOUT,buf)
  52. exit
  53.  
  54. /* align text to right of field  adding spaces or trucating on left to fit   */
  55. right_justify:
  56.   if length(arg(1)) > arg(2) then return (right(arg(1),arg(2)))
  57.   else return (copies(" ",arg(2)-length(arg(1))) || arg(1))
  58.  
  59. /* align text to left of field  adding spaces or trucating on right to fit   */
  60. left_justify:
  61.   if length(arg(1)) > arg(2) then return (left(arg(1),arg(2)))
  62.   else return (arg(1) || copies(" ",arg(2)-length(arg(1))))
  63.